package com.nf.action;

import com.nf.ITaxUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class TestAction {

    private ITaxUtil taxUtil;

    @RequestMapping("/tttt")
    public String tyyty(Model model, float a ){

        //暂时写2行代码
        ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext.xml");
        taxUtil = (ITaxUtil)ac.getBean("taxUtil");

        float resultTax = taxUtil.calcTax(a);
        model.addAttribute("resultTax",resultTax);
        return "a1";
    }


}
